<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="./jq-3.6.0.js"></script>
    <style>
        .box {
            height: 100px;
            width: 100px;
            background-color: cadetblue;
            border: 10px solid red;
            padding: 10px;
            margin: 10px;
            position: absolute;
            left: 5px;
        }
    </style>
</head>

<body style="margin: 0px;">
    <div style="position: relative;left: 10px;">
        <div class="box"></div>
    </div>

</body>
<script>
    //高
    console.log($('.box').width());
    //宽
    console.log($('.box').height());
    //innerWidth = 内间距+宽度
    console.log($('.box').innerWidth());
    //outerWidth = 内间距+宽度+边框
    console.log($('.box').outerWidth());
    //outerWidth = 内间距+宽度+边框+外边距
    console.log($('.box').outerWidth(true));
    //获取盒子距文档的距离
    console.log($('.box').offset().left);
    //设置盒子到距文档的距离
    // console.log($('.box').offset({
    //     left: 10
    // }));
    //position 用于获取距离定位父级左侧的距离
    console.log($('.box').position().left);
</script>

</html>